/*
 * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import hilog from '@ohos.hilog';
export class WrapperResolver {
  private DOMAIN = 0x8691
  private TAG = 'WrapperResolver'

  private serverList: string[];

  constructor() {
    hilog.info(this.DOMAIN, this.TAG, 'create Resolver');
  }

  public getServers(): string[] {
    return [
      '8.8.8.8',
      '2001:4860:4860::8888',
      '8.8.8.8:1053',
      '[2001:4860:4860::8888]:1053',
    ]
  }

  public setServers(paramList: string[]) {
    this.serverList = paramList;
  }

  public resolve(){

  }

  public resolve4(param: string){
    return param;
  }

  public resolve6(param: string){
    return param;
  }

  public resolveAny(){}

  public resolveCaa(){}

  public resolveCname(){}

  public resolveMx(){}

  public resolveNaptr(){}

  public resolveNs(){}

  public resolvePtr(){}

  public resolveSoa(){}

  public resolveSrv(){}

  public resolveTxt(param: string): Promise<string[][]>{
    return [][param];
  }

  public reverse(){}
}

export class dns {
  static lookup(hostname: string, arg1: { all: boolean }) {
    let result:Promise<LookupAddress[]>;
    return result
  }

  static Resolver() {
    return new WrapperResolver();
  }

  static resolveTxt(hostname: string): Promise<string[][]> {
    return [][hostname];
  }
}

export interface LookupAddress {
  address: string;
  family: number;
}

